<!--
 * @Author: TonyJiangWJ
 * @Date: 2020-11-29 13:17:06
 * @Last Modified by: TonyJiangWJ
 * @Last Modified time: 2020-12-30 09:21:06
 * @Description: 
-->
<!DOCTYPE html>
<html lang=en>

<head>
  <meta charset=utf-8>
  <meta http-equiv=X-UA-Compatible content="IE=edge">
  <meta name=viewport content="width=device-width,initial-scale=1">
  <title>可视化测试工具</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.10/lib/index.css" />
  <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.6/dist/vue.min.js"></script> -->
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script src="https://unpkg.com/vue-router@3.4.9/dist/vue-router.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vant@2.10/lib/vant.min.js"></script>
</head>

<body>
  <noscript><strong>We're sorry but this doesn't work properly without JavaScript enabled. Please enable
      it to continue.</strong></noscript>
  <div id=app class="root-container" v-cloak style="min-height:755px;background: #ffffff;">
    <!-- <image-data-visual-test /> -->
    <router-view></router-view>
  </div>
</body>
<script type="text/javascript">
  /** 
   * 加载本地js文件
   */
  function appendScripts(filePath) {
    let element = document.createElement('script')
    // element.src = 'file://' + filePath + '/vue_configs/js/vue.min.js'
    // document.head.appendChild(element)
    let scripts = [
      '/vue_configs/js/webview_bridge.js',
      '/vue_configs/js/components/common.js',
      '/test/visual_test/js/components/visual_test.js',
      '/test/visual_test/js/components/index.js',
      '/test/visual_test/js/index.js',
      '/test/visual_test/js/app.js'
    ]
    let index = 0
    scripts.forEach(script => {
      setTimeout(function () {
        element = document.createElement('script')
        element.src = filePath + script
        document.head.appendChild(element)
      }, 100 + (index++) * 10)
    })
    console.log('append scripts done')
    let csses = ['/vue_configs/css/style.css']
    csses.forEach(css => {
      element = document.createElement('link')
      element.href = filePath + css
      element.rel = "stylesheet"
      document.head.appendChild(element)
    })
    console.log('append css done')
  }
  function nativeInvoke(message) {
    //document.getElementById('content').innerText = message
  }

  // 挂载本地js脚本
  window.onload = () => {
    let location = window.location.href
    appendScripts(location.substring(0, location.indexOf('/test/visual_test/index.html')))
  }
  /**
   * 禁用长按菜单，复制等 
   **/
  window.addEventListener('contextmenu', function (e) {
    e.preventDefault()
  })
</script>

</html>